import time
from threading import Thread


def work1():
    for i in range(5):
        time.sleep(1)
        print(f"work({i})-------")


def work2():
    for i in range(5):
        time.sleep(1)
        print(f"work({i})--------")

def work3():
    for i in range(5):
        time.sleep(1)
        print(f"work({i})--------")

if __name__ == '__main__':
    s_t=time.time()
    t1=Thread(target=work1)
    t1.start()
    # t1.join(2)
    # t1.join() 不传参数默认等待该子线程执行结束，可以通过参数设定等待时间
    t2=Thread(target=work2)
    t2.start()
    # work3()
    e_t=time.time()
    print("运行时间：",e_t-s_t)